package puzzle.projecteuler.p100;


public class Problem004 {

	public static void main(String[] args) {

		int max = -1;
		for (int i = 100; i < 1000; i ++) {
			for (int j = 100; j < 1000; j ++) {
				int n = i*j;
				if (isPalindromic(n) && n > max) {
					max = n;
				}
			}
		}
		System.out.println(max);
	}
	private static boolean isPalindromic(int n) {
		
		String s1 = String.valueOf(n);
		char[] cs = s1.toCharArray();
		for (int i = 0; i < cs.length; i ++) {
			if (cs[i] != cs[cs.length-1-i]) {
				return false;
			}
		}
		return true;
	}
}
